<template>
  <div class="letter-setting__buy">
    <div>
      <div class="letter-setting__buy--input">
        <header>账户剩余短信：100条</header>
        <div>
          <div>单价：￥0.05</div>
          <div>支付方式：微信支付</div>
        </div>
        <div>
          <n-input-number placeholder="请输入购买数量" :show-button="false" clearable />
          <button>应付金额￥0</button>
        </div>
      </div>
      <div class="letter-setting__buy--table">
        <header class="my-title--primary">购买记录</header>
        <n-data-table :columns="columns" :data="data" :max-height="353" striped />
      </div>
    </div>
    <div>
      <n-pagination v-model:page="page" :page-count="100" :page-slot="7">
        <template #prev>
          上一页
        </template>
        <template #next>
          下一页
        </template>
        <template #suffix>
          <div class="pagination__jump-page">
            到<input type="number">页
            <button>确定</button>
            <span>10 条 / 页</span>
          </div>
        </template>
      </n-pagination>
    </div>
  </div>
  <n-modal v-model:show="model" body-style="--n-box-shadow: none;">
    <div class="letter-payment-code">
      <img :src="prefixOssUrl('member/invitation-code-bg.png')" />
      <div class="letter-payment-code__content">
        <header>支付金额</header>
        <div>￥<span>50</span></div>
        <section><img /></section>
        <footer>
          <div>请使用微信扫支付</div>
          <div>有效期5分钟</div>
        </footer>
        <button>
          确认
        </button>
      </div>
    </div>
  </n-modal>
</template>
<script setup>
import { ref, inject } from 'vue';
const { prefixOssUrl } = inject('globalMethods');
const model = ref(true);
const columns = [
  {
    title: '交易时间',
    key: 'time'
  },
  {
    title: '购买数量',
    key: 'quantity'
  },
  {
    title: '支付金额',
    key: 'money'
  },
  {
    title: '状态',
    key: 'status'
  }
], data = Array.from({ length: 46 }).map((_, index) => ({
  key: index,
  time: `2022-02-25 09:51:18`,
  quantity: (index),
  money: (index + 1) * 10,
  status: '待支付'
}));
</script>
<style lang="less" scoped>
.letter-setting__buy {
  display: grid;
  grid-template-columns: auto;
  grid-template-rows: auto 128px;
  height: 100%;

  >div:first-child {
    display: grid;
    grid-template-columns: auto;
    grid-template-rows: 242px auto;
    margin: 0 30px;

    .letter-setting__buy--input {
      padding: 0 30px;
      background: #F8F8F8;
      box-sizing: border-box;
      box-shadow: 0px 3px 6px 0px rgba(0, 0, 0, 0.1);
      border-radius: 4px;

      >header {
        margin-bottom: 25px;
        padding-top: 29px;
        font-size: 30px;
        font-weight: bold;
        color: #2E323D;
      }

      >header+div {
        display: flex;
        font-size: 24px;
        color: #4A5060;

        >div:last-child {
          margin-left: 90px;
        }
      }

      >div:last-child {
        display: grid;
        grid-template-columns: auto 220px;
        grid-template-rows: 80px;
        grid-gap: 20px;
        margin-top: 20px;

        /deep/ .n-input {
          .n-input__input-el {
            height: 80px;
          }
        }

        >button {
          width: 100%;
          height: 100%;
          font-size: 26px;
          background-color: #ABCEF5;
          color: #FEFEFF;
          text-align: center;
          line-height: 80px;
        }
      }
    }

    .letter-setting__buy--table {
      display: grid;
      grid-template-columns: auto;
      grid-template-rows: 82px auto;

      .my-title--primary {
        display: flex;
        align-items: center;

        &::before {
          display: block;
          position: initial;
          margin-right: 12px;
        }
      }
    }
  }

  >div:last-child {
    display: flex;
    align-items: center;
    padding-left: 30px;
    height: 100%;
    box-sizing: border-box;
    box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.2);

    .pagination__jump-page {
      font-size: 26px;
      color: #4a5060;
      margin: 0 18px;

      input {
        margin: 0 15px;
        width: 64px;
        height: 42px;
        text-align: center;
        background: #f8f8f8;
        border: 1px solid #e5e5e5;
        border-radius: 5px;
      }

      button {
        margin: 0 30px;
        width: 88px;
        height: 44px;
        color: #fdfdfd;
        background: #2c8cf0;
        border-radius: 5px;
      }
    }
  }

}

.letter-payment-code {
  position: relative;

  * {
    line-height: 1;
  }

  >img {
    width: 630px;
    height: 760px;
  }

  &__content {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;

    >header {
      margin: 40px 0 17px;
      font-size: 36px;
      color: #333;
    }

    >div {
      display: flex;
      justify-content: center;
      align-items: baseline;
      margin-bottom: 16px;
      font-size: 28px;
      font-weight: bold;
      color: #2E323D;

      >span {
        font-size: 48px;
      }
    }

    >section {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 312px;
      height: 312px;
      box-shadow: 0 0 0 10px #009944 inset;

      >img {
        width: 288px;
        height: 280px;
      }
    }

    >footer {
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-top: 30px;

      >div:first-child {
        font-size: 26px;
        color: #909399;
      }

      >div:last-child {
        margin-top: 19px;
        font-size: 28px;
        font-weight: bold;
        color: #2e323d;
      }
    }

    >button {
      position: absolute;
      bottom: 60px;
      width: 158px;
      height: 60px;
      font-size: 24px;
      line-height: 60px;
      color: #fff;
      background: #2c8cf0;
      border-radius: 30px;
      text-align: center;
    }
  }
}
</style>